package work.ib.apt.perf.review;


import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import work.ib.apt.perf.TestMain;

public class GetReviewDetails extends TestMain {

//	private static final String url = "http://localhost:8000/services/review/v1/getReviewDetails";
	private static final String url = "http://dev-aptratings-services1.internetbrands.com:8080/services/review/v1/getReviewDetails";


	private static final Integer parallelThreads = 4;

	// Some reviews ids, taken from dev DB
	private static int[] reviewIdsDev = new int[] {
		 111406844,		 111406400,		 111406399,		 111406398,
		 111406397,		 111406396,		 111406395,		 111406394,
		 111406393,		 111406392,		 111406391,		 111406390,
		 111406389,		 111406388,		 111406387,		 111406386,
		 111406385,		 111406384,		 111406383,		 111406382,
		 111406381,		 111406380,		 111406379,		 111406378,
		 111406377,		 111406376,		 111406375,		 111406374,
		 111406373,		 111406372,		 111406371,		 111406370,
		 111406369,		 111406368,		 111406367,		 111406366,
		 111406365,		 111406364,		 111406363,		 111406362,
		 111406361,		 111406360,		 111406359,		 111406358,
		 111406357,		 111406356,		 111406355,		 111406354,
		 111406353,		 111406352,		 111406351,		 111406350,
		 111406349,		 111406348,		 111406347,		 111406346,
		 111406344,		 111406343,		 111406342,		 111406341,
		 111406340,		 111406339,		 111406338,		 111406337,
		 111406336,		 111406335,		 111406333,		 111406332,
		 111406331,		 111406330,		 111406329,		 111406328,
		 111406327,		 111406326,		 111406325,		 111406324,
		 111406323,		 111406322,		 111406321,		 111406320,
		 111406319,		 111406318,		 111406317,		 111406316,
		 111406315,		 111406314,		 111406313,		 111406312,
		 111406311,		 111406310,		 111406309,		 111406308,
		 111406307,		 111406306,		 111406305,		 111406304,
		 111406303,		 111406302,		 111406301,		 111406300,
	};

	// Some reviews ids, taken from my local DB
	private static int[] reviewIdsLocal = new int[] {
		8733203,		8733202,		8733201,		8733200,
		8733199,		8733198,		8733197,		8733196,
		8733188,		8733187,		8733174,		8733173,
		8733172,		8733171,		8733170,		8733169,
		8733168,		8733167,		8733166,		8733165,
		8733164,		8733163,		8733162,		8733161,
		8733160,		8733159,		8733158,		8733157,
		8733156,		8733155,		8733154,		8733153,
		8733152,		8733151,		8733150,		8733149,
		8733148,		8733147,		8733146,		8733145,
		8733144,		8733143,		8733142,		8733141,
		8733139,		8733138,		8733137,		8733136,
		8733135,		8733134,		8733133,		8733132,
		8733131,		8733130,		8733129,		8733128,
		8733127,		8733126,		8733125,		8733124,
		8733123,		8733122,		8733121,		8733120,
		8733119,		8733118,		8733117,		8733116,
		8733115,		8733114,		8733113,		8733112,
		8733111,		8733110,		8733109,		8733108,
		8733107,		8733106,		8733105,		8733104,
		8733103,		8733102,		8733101,		8733100,
		8733099,		8733098,		8733097,		8733096,
		8733095,		8733094,		8733093,		8733092,
		8733091,		8733090,		8733089,		8733088,
		8733087,		8733086,		8733085,		8733084,
	};

	public static void main(String[] args) {
		try {
			new GetReviewDetails().runTest();
		} catch (Exception e) {
			e.printStackTrace(System.out);
		}
	}

	@Override
	public Map<String, Object> getParameters() {
		Boolean loadImages = Boolean.TRUE;
		Boolean loadResponses = Boolean.TRUE;
		int[] dataArray = reviewIdsDev;
		long reviewId = dataArray[new Random().nextInt(dataArray.length)];
		Map<String,Object> params = new HashMap<String,Object>();

		params.put("reviewId", reviewId);
		params.put("loadImages", loadImages);
		params.put("loadResponses", loadResponses);
		params.put("format", "json");

		return params;
	}

	@Override
	public int getParallelThreads() {
		return parallelThreads;
	}

	@Override
	public String getURL() {
		return url;
	}
}
